\chapter{Some Differential Equations}


%\begin{example}
%Find orthogonal trajectories to the
%family of curves $y=ke^{-x}$.
%$y'=-y$.  Orthogonal trajectories thus
%satisfy $y'=1/y$, since slopes must be negative reciprocal of
%each other.  Solve $u'=1/u$.  Get $u=\sqrt{2x+c}$.
%\end{example}

This chapter is an introduction to differential equations, a 
major field in applied and theoretical
mathematics and a very useful one for engineers, scientists, 
and others who study changing phenomena.
The physical laws of motion and heat and electricity can be 
written as differential equations. The growth of
a population, the changing gene frequencies in that population, 
and the spread of a disease can be described
by differential equations. Economic and social models use differential 
equations, and the earliest examples
of "chaos" came from studying differential equations used for modeling 
atmospheric behavior. Some
scientists even say that the main purpose of a calculus course 
should be to teach people to understand and
solve differential equations.


{\bf Differential Equations}

Algebraic equations contain constants and variables, and the solutions of an
algebraic equation are typically numbers. For example, 
$x = 3$ and $x = -2$ are solutions of the algebraic equation 
$x^2 = x + 6$. Differential equations contain
derivatives or differentials of functions. Solutions of 
differential equations are functions. The differential equation 
$y' = 3x^2$ has infinitely many solutions, and
two of those solutions are the functions $y = x^3 + 2$ and 
$y = x^3 - 4$. You have already solved lots of differential 
equations: every time you found an
antiderivative of a function $f(x)$, you solved the differential 
equation $y' = f(x)$ to get a solution $y$. You have also used 
differential equations in applications. Areas, volumes, work, and 
motion problems all involved integration and finding
antiderivatives so they all used differential equations. The 
differential equation $y' = f(x)$, however, is just the 
beginning. Other applications generate different
differential equations.

{\bf Checking Solutions of Differential Equations}

Whether a differential equation is easy or difficult to solve, 
it is important to be able to check that a
possible solution really satisfies the differential equation.
A possible solution of an algebraic equation can be checked 
by putting the solution into the equation to see if
the result is true: $x = 3$ is a solution of $5x + 1 = 16$ since 
$5(3) + 1 = 16$ is true. Similarly, a solution of a
differential equation can be checked by substituting the 
function and the appropriate derivatives into the
equation to see if the result is true: $y = x^2$ is a solution of 
$xy' = 2y$ since $y' = 2x$ and $x(2x) = 2(x^2)$ is true.


                                                          2
\begin{example}
For every value of $C$, the function $y = Cx^2$ is a solution of
$xy' = 2y$. Find the value of $C$ so that $y(5) = 50$.

Solution:  Substituting the initial condition $x = 5$ and $y = 50$ into
the solution $y = Cx^2$, we have that $50 = C5^2$ so
$C = 50/25 = 2$. The function $y = 2x^2$ satisfies both the
differential equation and the initial condition.
\end{example}

\section{Separable Equations}

A {\it separable differential equation} is a first order
differential equation that can be written in the form
$$
  \frac{dy}{dx} = \frac{f(x)}{h(y)}.
$$
These can be solved by integration, by noting that
$$
   h(y) dy = f(x) dx,
$$
hence 
$$
  \int   h(y) dy = \int f(x) dx + C.
$$
This latter equation defines $y$ implicitly as a function of $x$
(we have added a ``$+C$'' onto one side just to emphasize that
you only need one constant of integration for the solution), and
in some cases it is possible to explicitly solve for $y$ as a function
of $x$.

\section{Logistic Equation}

The logistics equation is a differential equation that models
population growth.  Often in practice a differential equation models
some physical situation, and you should ``read it'' as doing so.

Exponential growth:
$$
  \frac{1}{P} \frac{dP}{dt} = k.
$$
This says that the ``relative (percentage) growth rate'' is constant.
As we saw before, the solutions are
$$
  P_{(t)} = P_0 \cdot e^{kt}.
$$
Note that this model only works for a little while.  In everyday life
the growth couldn't actually continue at this rate indefinitely.  This
exponential growth model ignores limitations on resources, disease,
etc.  Perhaps there is a better model?

Over time we expect the growth rate should level off, i.e., decrease
to $0$. 
What about

\begin{equation}
\label{eqn:logistic}
 \frac{1}{P} \frac{dP}{dt} = k \left(1 - \frac{P}{K}\right),
\end{equation}
where $K$ is some large constant called the {\it carrying capacity},
which is much bigger than $P=P(t)$ at time $0$.  The carrying capacity
is the maximum population that the environment can support.  
Note that if $P>K$, then $dP/dt<0$ so the population declines.
The differential equation (\ref{eqn:logistic}) is called the logistic
model (or logistic differential equation).  There are, of course,
other models one could use, e.g., the Gompertz equation.

First question: are there any {\it equilibrium solutions} to
(\ref{eqn:logistic}), i.e., solutions with $dP/dt = 0$, i.e., constant
solutions?  In order that $dP/dt = 0$ then $0 = k \left(1 -
  \frac{P}{K}\right)$, so the two equilibrium solutions are $P(t)=0$ and
$P(t)=K$.

The logistic differential equation (\ref{eqn:logistic}) is separable,
so you can separate the variables with one variable on one side of
the equality and one on the other.    This means we can easily solve
the equation by integrating.  We rewrite the equation as
$$
 \frac{dP}{dt} = -\frac{k}{K} P (P - K).
$$
Now separate:
$$
 \frac{KdP}{P(P-K)} = -k \cdot dt,
$$
and integrate both sides
$$
 \int \frac{KdP}{P(P-K)} = \int -k \cdot dt = -kt + C.
$$
On the left side we get
$$
 \int \frac{KdP}{P(P-K)} = \int \left( \frac{1}{P-K} - \frac{1}{P} \right) dP 
      = \ln|P-K| - \ln|P| + *
$$
Thus 
$$
\ln|K-P| - \ln|P|  = -kt + c,
$$
so
$$
\ln|(K-P)/P|  = -kt + c.
$$
Now exponentiate both sides:
$$
(K-P)/P  = e^{-kt + c} = A e^{-kt}, \qquad \text{where $A=e^{c}$}.
$$
Thus 
$$K = P(1+Ae^{-kt}),$$
so 
$$
 P(t) = \frac{K}{1+A e^{-kt}}.
$$
Note that $A=0$ also makes sense and gives an equilibrium solution.
In general we have $\lim_{t\to\infty} P(t) = K$.
In any particular case we can determine $A$ as a function of $P_0 = P(0)$
by using that
$$
  P(0) = \frac{K}{1+A}\qquad\text{so}\qquad A 
= \frac{K}{P_0} - 1 = \frac{K-P_0}{P_0}.
$$

